package cn.buk.api.ctrip.dto.hotel;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.util.List;

/**
 * Created by william on 2015-1-22.
 */
@XStreamAlias("RoomStay")
public class HotelAvailResponseRoomStay {

    /**
     * 房价可用性，AvailableForSale:可预订
     NoAvailable：不可预订
     */
    @XStreamAsAttribute
    @XStreamAlias("AvailabilityStatus")
    private String availabilityStatus;

    @XStreamAlias("RatePlans")
    private List<HotelAvailResponseRatePlan> ratePlans;

    @XStreamAlias("RoomRates")
    private List<HotelAvailResponseRoomRate> roomRates;

    @XStreamAlias("CancelPenalties")
    private List<HotelAvailResponseCancelPenalty> cancelPenalties;

    /**
     * 预存类支付：用于不可变担保制度：全额担保、一律担保和峰时担保。这3种担保制度在预订时就可明确知道是否需要担保，跟客人的入住行为无关。分销商需要验证双方担保金额是否相符
     */
    @XStreamAlias("DepositPayments")
    private List<HotelAvailResponseGuaranteePayment> guaranteePayments;

    /**
     * 总价，分销商需要验证双方总价是否相符
     *
     */
    @XStreamAlias("Total")
    private HotelAvailResponseAmountBeforeTax total;


    /**
     * 房型是否可订
     * @return
     */
    public boolean isAvailable() {
        if (availabilityStatus == null) return false;

        return this.availabilityStatus.equalsIgnoreCase("AvailableForSale");
    }



    //setter and getter
    public String getAvailabilityStatus() {
        return availabilityStatus;
    }

    public void setAvailabilityStatus(String availabilityStatus) {
        this.availabilityStatus = availabilityStatus;
    }

    public List<HotelAvailResponseRatePlan> getRatePlans() {
        return ratePlans;
    }

    public void setRatePlans(List<HotelAvailResponseRatePlan> ratePlans) {
        this.ratePlans = ratePlans;
    }

    public List<HotelAvailResponseRoomRate> getRoomRates() {
        return roomRates;
    }

    public void setRoomRates(List<HotelAvailResponseRoomRate> roomRates) {
        this.roomRates = roomRates;
    }

    public List<HotelAvailResponseCancelPenalty> getCancelPenalties() {
        return cancelPenalties;
    }

    public void setCancelPenalties(List<HotelAvailResponseCancelPenalty> cancelPenalties) {
        this.cancelPenalties = cancelPenalties;
    }

    public List<HotelAvailResponseGuaranteePayment> getGuaranteePayments() {
        return guaranteePayments;
    }

    public void setGuaranteePayments(List<HotelAvailResponseGuaranteePayment> guaranteePayments) {
        this.guaranteePayments = guaranteePayments;
    }

    public HotelAvailResponseAmountBeforeTax getTotal() {
        return total;
    }

    public void setTotal(HotelAvailResponseAmountBeforeTax total) {
        this.total = total;
    }
}
